var bmap = require('../utils/bmap-wx.min.js');

function get(that){
    var BMap = new bmap.BMapWX({
      ak: 'DDjL4NS4aaaGL0iWaR1ddlfF6i93Yb4z'
    });
    var fail = function (data) {
      console.log(data)
    };
    var success = function (data) {
      var wxMarkerData = data.wxMarkerData;
      that.setData({
        markers: wxMarkerData,
        latitude: wxMarkerData[0].latitude,
        longitude: wxMarkerData[0].longitude,
        address: wxMarkerData[0].address
      });
    }
    // 发起regeocoding检索请求 
    BMap.regeocoding({
      fail: fail,
      success: success
    });
}

module.exports={
    get:get
}